package shuailong;

import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.util.StringTokenizer;

/**
 * Created by zzy on 2018/1/15.
 */
public class AnswerB01 {


    public static void main(String[] args) throws IOException {
        StringTokenizer tokenizer1=getTokenzer("a.txt");
        StringTokenizer tokenizer2=getTokenzer("b.txt");
        PrintStream out=new PrintStream("G:/英雄时刻/c.txt");
        while (tokenizer1.hasMoreTokens()&&tokenizer2.hasMoreTokens()){
            out.println(tokenizer1.nextToken());
            out.println(tokenizer2.nextToken());
        }
        out.close();
    }


    private static StringTokenizer getTokenzer(String fileName) throws IOException {
        InputStreamReader reader=new InputStreamReader(AnswerB01.class.getResourceAsStream(fileName));//获取同包下面的文件
        StringBuilder builder=new StringBuilder(1000);
        int length=-1;
        char[] cs=new char[1024];
        while ((length=reader.read(cs))!=-1){
            builder.append(cs,0,length);
        }
        reader.close();
        return new StringTokenizer(builder.toString());
    }
}
